package com.tank.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tank.bean.User;
import com.tank.bean.item.Product;
import com.tank.bean.product.ParentType;
import com.tank.bean.product.SonType;
import com.tank.dao.ItemsManageDao;
import com.tank.service.ItemsManageService;

@Service("itemsManageService")
public class ItemsManageServiceImpl implements ItemsManageService{
	@Autowired
	private ItemsManageDao itemsManageDao;
	public List<ParentType> queryItemsType() {
		try{
			return itemsManageDao.queryItemsType();
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public List<Product> queryPublicItemsMessage() {
		try{
			return itemsManageDao.queryPublicItemsMessage();
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
		
	}

	public List<SonType> queryItemsSonType(long parentId) {
		try{
			return itemsManageDao.queryItemsSonType(parentId);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public void uploadItems(Product product) {
		try{
			itemsManageDao.uploadItems(product);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}

	public List<User> queryDarenList() {
		try{
			return itemsManageDao.queryDarenList();
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public List<Product> queryHotItems() {
		try{
			return itemsManageDao.queryHotItems();
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public Product querySingleItems(long productId) {
		try{
			return itemsManageDao.querySingleItems(productId);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public List<Product> queryItems(long userId, int type) {
		try{
			return itemsManageDao.queryItems(userId, type);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public void updateItem(Product product) {
		try{
			itemsManageDao.updateItem(product);
		}catch (Exception e) {
			e.printStackTrace();
		}
	}
}
